package dao.jpa;

import java.io.Serializable;
import java.util.Date;
import java.util.List;

import org.hibernate.Criteria;
import org.hibernate.criterion.Restrictions;
import org.springframework.stereotype.Repository;

import dao.CompraDAO;
import entity.Compra;

@Repository
public class CompraJpaDAO extends GenericJpaDAO<Compra> implements CompraDAO, Serializable {

	private static final long serialVersionUID = -7769051838144785979L;
	
	
	@SuppressWarnings("unchecked")
	@Override
	public List<Compra> listarComprasPeriodo(Date dataInicial, Date dataFinal) {
		Criteria criteria = criarCriteria();
		return criteria.add(Restrictions.between("dataCompra", dataInicial, dataFinal)).list();
	}

}
